package com.cityp.service.impl;

import com.cityp.bean.scene;
import com.cityp.mapper.sceneMapper;
import com.cityp.service.sceneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class sceneServiceImpl implements sceneService {
    @Autowired
    private sceneMapper sceneMapper;

    @Override
    public List<scene> viewAll(){
        return sceneMapper.viewAll();
    }
    @Override
    public int addOne(scene Scene){
        return sceneMapper.addOne(Scene);
    }
    @Override
    public int delOne(int id){
        return sceneMapper.delOne(id);
    }

    @Override
    public int changeOne(int id, int type,String para) {
//        return switch (type) {
//            case 1 -> sceneMapper.switchScene(id);
//            case 2 -> sceneMapper.changeName(para, id);
//            case 3 -> sceneMapper.changeFileName(para, id);
//            case 4 -> sceneMapper.changeIntroduce(para, id);
//            case 5 -> sceneMapper.switchTest(id);
//            default -> 0;
//        };
        if (type == 1) {
            return sceneMapper.switchScene(id);
        } else if (type == 2) {
            return sceneMapper.changeName(para, id);
        } else if (type == 3) {
            return sceneMapper.changeFileName(para, id);
        } else if (type == 4) {
            return sceneMapper.changeIntroduce(para, id);
        }
        else if(type == 5){
            return sceneMapper.switchTest(id);
        }
        return 0;
    }
}
